/*
 * Created on 28-Jul-2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package sceneMatch;

import java.io.Serializable;

/**
 * @author david.tudino
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class MatchNode implements Serializable {
	
	public short node_number;

	public float radius;

	public MatchNode spouse;

	public MatchNode tight_towards_tree_root, tight_away_from_tree_root, sibling;

	public MatchNode next_node;

	public boolean counted = false;
	
	public boolean is_blue = false;
	
	public float x;
	public float y;
	
	public float distance_to(MatchNode other_node)
	{
		return( (float)(  Math.sqrt( (x - other_node.x)*(x - other_node.x) +
				(y - other_node.y)*(y - other_node.y) ) ) );
	}
	
	
	/*
	public void resetNode () {
		tight_towards_tree_root = null;
		tight_away_from_tree_root = null;
		sibling = null;
		counted = false;
		radius = 0.0f;
		
		if (next_node != null) {
			next_node.resetNode();
		}
	}
	
	public void addNextNode (MatchNode newNode) {
		if (next_node == null) {
			next_node = newNode;
			next_node.node_number = (short)(node_number + 1);
			next_node.is_blue = is_blue;
		} else {
			next_node.addNextNode(newNode);
		}
	}
	*/
	public void printLinkedList () {
		System.out.print("node_number: " + node_number + ", node_color: " + is_blue + ", x: " + x + ", y: " + y + ", child_node: ");
		if (next_node != null) {
			System.out.println(next_node.node_number);
			next_node.printLinkedList();
		} else {
			System.out.println("null");
		}
	}
}
